import io from 'socket.io-client'

const socket = io('http://localhost:3000',{
  reconnection: true,
  reconnectionAttempts: 5,
  reconnectionDelay: 1000,
  reconnectionDelayMax: 5000,
  randomizationFactor: 0.5,
  pingInterval: 5000, // 设定自定义心跳间隔时间，默认值为25000毫秒
  pingTimeout: 3000, 
  upgrade: false, // 禁用升级协议
  transports: ['websocket'],
  query: { // 设置心跳包的内容
    heartbeat: 'custom heartbeat'
  }
}) // 根据实际情况修改连接地址

export default {
  install: function (Vue) {
    Vue.prototype.$socket = socket
  }
}